package com.myapp.web.struts2.ui;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ui.AbstractClosingTag;
import com.myapp.web.struts2.components.ContainerUIBean;
import com.opensymphony.xwork2.util.ValueStack;

public class ContainerTag extends AbstractClosingTag {
	
	private static final long serialVersionUID = -4466803189398118408L;	
	
	private String prefixClass;

	private Integer pieceSize ;
	
	public void setPieceSize(Integer size) {
		this.pieceSize = size;
	}
	
    protected void populateParams() {
        super.populateParams();
        ContainerUIBean bean = (ContainerUIBean) component;
        bean.setPieceSize(pieceSize);
        bean.setPrefixClass(prefixClass);             
    }   

    public void setPrefixClass(String prefixClass) {
		this.prefixClass = prefixClass;
	}
    
	@Override
	public Component getBean(ValueStack stack, HttpServletRequest req,
			HttpServletResponse res) {
		return new ContainerUIBean(stack, req, res);
	}
}
